<template>
  <div class="rechargeStatistics">
    <h3>充值统计</h3>
    <div id="myEcharts"></div>
  </div>
</template>
<script>
export default {
  name: "rechargeStatistics",
  data() {
    return {};
  },
  mounted() {
    this.creatEcharts();
  },
  methods: {
    creatEcharts() {
      // 基于准备好的dom，初始化echarts实例
      let myChart = this.$echarts.init(document.getElementById("myEcharts"));
      // 指定图表的配置项和数据
      let option = {
        title: {
          text: "近1月用户充值数"
        },
        tooltip: {
          trigger: "axis"
        },
        legend: {
          data: ["订单金额"]
        },
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
        },
        yAxis: {
          type: "value"
        },
        series: [
          {
            name: "订单金额",
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: "line",
            smooth: true
          }
        ]
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    }
  }
};
</script>
<style scoped>
h3 {
  padding: 0.2rem;
  color: #3c763d;
}
#myEcharts {
  width: 100%;
  height: 5rem;
}
</style>